 function writeFiles(path,content) {
    return new Promise(function(resolve,reject) {
        var fs = require('fs')
        let contentStr = content + '\n'
        fs.writeFile(path,contentStr,{flag: 'a',encoding:'utf-8'},function(err){
            if(err) {
                console.log('写入失败')
                reject(err)
            } else {
                console.log('写入成功')
                resolve(err) // 这里其实不需要传参数的
            }
        })
    })
}
 function readFiles (path){
    return new Promise(function(resolve,reject) {
        var fs = require('fs')
        fs.readFile(path,{flag:'r',encoding:'utf-8'},function(err,data) {
            if (err) {
                reject(err)
            } else {
                resolve(data)
            }
        })
    })
}
module.exports = {
    readFiles,
    writeFiles
}
